package com.gxuwz.medical.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.gxuwz.medical.domain.chronicSyndrome.ChronicSyndrome;
import com.gxuwz.medical.domain.member.Member;
import com.gxuwz.medical.exception.DbException;

public class ChronicSyndromeDao extends GenericDao<ChronicSyndrome>{

	@Override
	protected ChronicSyndrome handle(ResultSet rs) throws SQLException {
		try{
			ChronicSyndrome model = new ChronicSyndrome();
			
			Member member = new Member();
			member.loadDByIdcard(rs.getString("idcard"));
			model.setMember(member);
			model.setMxbzcode(rs.getString("mxbzcode"));
			model.setIdcard(rs.getString("idcard"));
			model.setChronicname(rs.getString("chronicname"));
			model.setStartTime(rs.getString("startTime"));
			model.setEndTime(rs.getString("endTime"));
			model.setName(rs.getString("name"));
			model.setStatus(rs.getString("status"));
			model.setCreattime(rs.getDate("creattime"));
			model.setCreator(rs.getString("creator"));
			return model;
		}catch(SQLException e){
			throw new SQLException("结果集转为实例失败!",e);
		}
		
	}
	
	/**
	 * 查询所有报销单信息
	 * @return
	 * @throws DbException
	 */
	public List<ChronicSyndrome> ChronicSyndromeList() throws DbException{
		try{
			String sql = "select * from t_chronic_syndrome";
			Object[]params={};
			return super.queryOjects(sql, params);
		}catch(SQLException e){
			throw new DbException("查询失败");
		}
	}

}
